
<html>
<title> Views </title>
<body>
  <br/>
  <br/>
<?
/**
* Process the header
*
*/
$CFetchers->fetchLstDataHeader($COracle,
                               $jobId,
                               $srcDbHdr,
                               $nHeader,
                               $lstHeader);

echo  /**
      * Global header
      *
      */
      "<table border='1' class='dedeq' >\n".
      "<tr>\n".

        "<td><b>DATE </b></td> <td > ".date("d-m-Y",
                                            strtotime($lstHeader["TR_DATE"][0]))." </td> \n".

        "</tr>\n".
        "<tr>\n".

        "<td><b>DUE  </b></td> <td > ".date("d-m-Y",
                                            strtotime($lstHeader["DUE_DATE"][0]))." </td> \n".
      "</tr>\n".
      "<tr>\n".

        "<td><b> SUPPLIER </b></td><td> ".$lstHeader["SUPPLIER_NAME"][0]." </td>\n".

      "</tr>\n".
      "<tr>\n".

        "<td><b>CURRENCY </b></td> <td> ".$lstHeader["CURRENCY"][0]." </td>\n".

      "</tr>\n".
      "<tr>\n".

        "<td><b>RATE     </b></td> <td> ".$lstHeader["RATE"][0]."</td>\n".

      "</tr>\n".
      "<tr>\n".

        "<td><b>CR-TERM  </b></td> <td> ".$lstHeader["CREDIT_TERM"][0]." </td>\n".

      "</tr>\n".
      "<tr>\n".

        "<td><b>NOTA SOURCE</b></td> <td> ".$lstHeader["NOTA_SRC"][0]." </td>\n".

      "</tr>\n".
      "<tr>\n".

        "<td><b>MEMO     </b></td> <td> ".$lstHeader["MEMO"][0]."   </td>\n".

      "</tr>\n".
      "</table><br/>\n";

?>



<?
/**
* Process detail
*
*/
$CLFetchers->fetchLstDataDetail($COracle,
                                $jobId,
                                $srcDbDtl,
                                $nDetail,
                                $lstDetail);

$CLFetchers->fetchLstDataDetail($COracle,
                                $jobId,
                                $srcDbSubDtl,
                                $nSubDetail,
                                $lstSubDetail);

echo  "<table border='1' class='dedeq'>\n".
      "<th> NO      </th>\n".
      "<th> Model   </th>\n".
      "<th> Cvt     </th>\n".
      "<th> Cvt-Qty </th>\n".
      "<th> Unit    </th>\n".
      "<th> Qty     </th>\n".
      "<th> WHS     </th>\n".
      "<th> Price   </th>\n".
      "<th> #       </th>\n".
      "<th> DISC%   </th>\n".
      "<th> DISC    </th>\n".
      "<th> NET     </th>\n";

for($iRow = 0; $iRow < $nSubDetail ; $iRow++){

  echo  "<tr>\n".

        "<td> ".($iRow+1)." </td>\n".

        "<td> ".$lstSubDetail["MODEL"][$iRow]."     </td>\n".

        "<td> ".$lstSubDetail["CVT"][$iRow]."       </td>\n".

        "<td align='right'> ".number_format($lstSubDetail["CVT_QTY"][$iRow],2,'.',',')."   </td>\n".

        "<td> ".$lstSubDetail["UNIT"][$iRow]."      </td>\n".

        "<td align='right'> ".number_format($lstSubDetail["QTY"][$iRow],2,'.',',')."       </td>\n".

        "<td> ".$lstSubDetail["WAREHOUSE"][$iRow]." </td>\n".

        "<td align='right'> ".number_format($lstSubDetail["PRICE"][$iRow],2,'.',',')."     </td>\n".

        "<td align='right'> ".number_format($lstSubDetail["HRZ_TOT"][$iRow],2,'.',',')."   </td>\n".

        "<td align='right'> ".number_format($lstSubDetail["DISC_PCTG"][$iRow],2,'.',',')." </td>\n".

        "<td align='right'> ".number_format($lstSubDetail["DISC"][$iRow],2,'.',',')."      </td>\n".

        "<td align='right'> ".number_format($lstSubDetail["NET"][$iRow],2,'.',',')."       </td>\n".
      "</tr>\n";
}

echo  "<tr>\n".

        "<td colspan='3'><b> TOTAL </b></td>\n".

        "<td>  </td>\n".

        "<td>  </td>\n".

        "<td>  </td>\n".

        "<td colspan='2'> </td>\n". //blank

        "<td align='right'> ".number_format($lstDetail["TOT_HRZ_TOT"][0],2,'.',',')." </td>\n".

        "<td> </td>\n". //blank

        "<td align='right'> ".number_format($lstDetail["TOT_DISC"][0],2,'.',',')."</td>\n".

        "<td align='right'> ".number_format($lstDetail["TOT_NET"][0],2,'.',',')."</td>\n".

      "</tr>\n";

echo  "<tr>\n".

        "<td align='right' ".$CHtml->rowColSpan( 1, 9)."><b>Disc% </b></td>\n".

        "<td align='right'> ".number_format($lstHeader["DISC_PCTG"][0],2,'.',',')." </td>\n".

        "<td><b>Disc  </b></td>\n".

        "<td align='right'> ".number_format($lstHeader["DISC"][0],2,'.',',')." </td>\n".

      "</tr>\n".
      "<tr>\n".

        "<td align='right' ".$CHtml->rowColSpan( 1, 11)."><b>Amount  </b></td>\n".

        "<td align='right'> ".number_format($lstHeader["AMOUNT"][0],2,'.',',')." </td>\n".

      "</tr>\n".
      "<tr>\n".

        "<td align='right' ".$CHtml->rowColSpan( 1, 9)."><b>Tax%  </b></td>\n".

        "<td align='right'> ".number_format($lstHeader["TAX_PCTG"][0],2,'.',',')." </td>\n".

        "<td><b>Tax   </b></td>\n".

        "<td align='right'> ".number_format($lstHeader["TAX"][0],2,'.',',')." </td>\n".

      "</tr>\n".
      "<tr>\n".

        "<td align='right' ".$CHtml->rowColSpan( 1, 11)."><b>Expense  </b></td>\n".

        "<td align='right'> ".number_format($lstHeader["EXPENSE"][0],2,'.',',')." </td>\n".

      "</tr>\n".
      "<tr>\n".

        "<td align='right' ".$CHtml->rowColSpan( 1, 11)."><b>Prepaid  </b></td>\n".

        "<td align='right'> ".number_format($lstHeader["PREPAID"][0],2,'.',',')." </td>\n".

      "</tr>\n".
      "<tr>\n".

        "<td align='right' ".$CHtml->rowColSpan( 1, 11)."><b>Payable  </b></td>\n".

        "<td align='right'> ".number_format($lstHeader["PAYABLE"][0],2,'.',',')." </td>\n".

      "</tr>\n";

echo  "</table>\n".
      "<br/>\n";
?>

<? $COracle->dc(); ?>
</html>